package com.weitu.permission.district.service.impl;

import com.weitu.permission.district.entity.Country;
import com.weitu.permission.district.mapper.CountryMapper;
import com.weitu.permission.district.service.CountryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CountryServiceImpl implements CountryService {
    private final CountryMapper countryMapper;

    @Autowired
    public CountryServiceImpl(CountryMapper countryMapper) {
        this.countryMapper = countryMapper;
    }

    public Country selectByPrimaryKey(String code) {
        return this.countryMapper.selectByPrimaryKey(code);
    }

    @Override
    @Transactional
    public int deleteByPrimaryKey(String code) {
        return this.countryMapper.deleteByPrimaryKey(code);
    }

    @Override
    @Transactional
    public int updateByPrimaryKeySelective(Country record) {
        return this.countryMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    @Transactional
    public int insertSelective(Country record) {
        return this.countryMapper.insertSelective(record);
    }

    @Override
    public List<Country> queryListByName(String name) {
        return this.countryMapper.queryList(name);
    }

    @Override
    public List<Country> queryList() {
        return this.countryMapper.queryList(null);
    }
}